<!doctype html>
<html>
 <head>
 <title></title>
 <meta charset="utf-8" />
 
 <script type="text/javascript">
document.addEventListener("DOMContentLoaded", iniciaeventos, 
false); 
function iniciaeventos() 
 { 
 document.getElementById('canvas').addEventListener("keydown", 
onKeyDown, false); 
 } 
 function onKeyDown(e)
 { 
       switch(e.keyCode)
		  {
		  case 39:
		  
                  alert('D');
		   break;
		   case 37:
		
                   alert('E');
		   break;
		   case 38:
		 
                  alert('C');
		   break;
		   case 40:
		
                   alert('B');
		   break;
		  }
		}
		
     
          
       
         
       
         
     
 
 
 </script>
 </head>
 <body>
 <canvas id="canvas" width="640" height="360" tabindex="0"></canvas>
 <script>
    
 document.getElementById('canvas').focus();
 </script>
     